{layout name="layout" /}

<div class="Hui-article">
	<article class="cl pd-20">
		<form action="" method="post" class="form form-horizontal" id="form-admin-powers-add">
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>上级权限</label>
				<div class="formControls col-xs-8 col-sm-3">
					<span class="select-box">
						<select class="select" id="pid" name="pid">
							<option value="0">--新增顶级权限--</option>
							{foreach $powers as $value}
							<option value="{$value.id}">---{$value.name}----</option>
							{notempty name="value.child"} {foreach $value.child as $val}
							<option value="{$val.id}">└-----{$val.name}--</option>
							{/foreach} {/notempty} {/foreach}
						</select>
					</span>
				</div>
			</div>
			<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>权限名称：</label>
				<div class="formControls col-xs-6 col-sm-4">
					<input type="text" class="input-text" value="" placeholder="请输入权限名称" id="name" name="name" />
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>icon or Controller or method：</label>
				<div class="formControls col-xs-6 col-sm-4">
					<input type="text" class="input-text" value="" placeholder="请输入控制器或方法名" id="method" name="method" />
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span> 说 明 ： </label>
				<div class="formControls col-xs-6 col-sm-4">
					<span style="color:red;">顶级权限填入图标(
						<a href="/static/h-ui/lib/Hui-iconfont/1.0.8/demo.html" target="_blank" style="color: blue;">图标示例</a>);
						<br/> 控制器填入小写字母, 大驼峰命名的转为小写加下划线, 示例:
						<pre> AdminUser ====> admin_user</pre>
						<br/> 方法名填入小写字母, 驼峰的直接转小写, 示例:
						<pre>getName  ====> getname</pre>
					</span>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">
					<span class="c-red">*</span>是否添加为侧栏目录：</label>
				<div class="formControls col-xs-8 col-sm-4 skin-minimal">
					<div class="radio-box">
						<input name="menu" type="radio" id="sex-1" value="1">
						<label for="sex-1">是</label>
					</div>
					<div class="radio-box">
						<input name="menu" type="radio" id="sex-2" value="0" checked>
						<label for="sex-2">否</label>
					</div>
				</div>
			</div>
			<div class="row cl">
				<label class="form-label col-xs-4 col-sm-3">备注：</label>
				<div class="formControls col-xs-8 col-sm-4">
					<textarea id="note" name="note" cols="" rows="" class="textarea" placeholder="备注...200个字符以内" dragonfly="true" onKeyUp="textarealength(this,100)"></textarea>
					<p class="textarea-numberbar">
						<em class="textarea-length">0</em>/200</p>
				</div>
			</div>
			<div class="row cl">
				<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					<button type="submit" class="btn btn-success radius" id="admin-role-save" name="">
						<i class="icon-ok"></i> 确&nbsp;定</button>
					<button type="button" class="btn btn-default radius" onclick="window.history.back();">
						<i class="icon-ok"></i> 取&nbsp;消</button>
				</div>
			</div>
		</form>
	</article>
</div>

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
	$(function () {
		$("#form-admin-powers-add").submit(function () {
			var desc = $("#note").val();

			if (!$("#name").val() || !$("#method").val) {
				layer.msg('权限名 or 控制器/方法', {
					icon: 5,
					time: 1000
				});

				return false;
			}

			if (getblen(desc) > 100) {
				layer.msg('备注过长', {
					icon: 5,
					time: 1000
				});

				return false;
			}
		})
	})
</script>